<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
        <script src="../../libs/layui/layui.js"></script>
        <link rel="stylesheet" href="../../libs/layui/css/layui.css" />
        <title>Layui - Switch切换 (v2.6.8)</title>
    </head>
    <body style="padding: 15px">
        <div class="layui-form">
            <input type="checkbox" name="xxx" lay-skin="switch" />
            <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em></em><i></i></div>
            <input type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked="" />
            <div class="layui-unselect layui-form-switch layui-form-onswitch" lay-skin="_switch"><em>ON</em><i></i></div>
            <input type="checkbox" name="zzz" lay-skin="switch" lay-text="开启|关闭" />
            <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>关闭</em><i></i></div>
            <input type="checkbox" name="aaa" lay-skin="switch" disabled="" />
            <div class="layui-unselect layui-form-switch layui-checkbox-disabled layui-disabled" lay-skin="_switch"><em></em><i></i></div>
        </div>

        <script type="text/javascript">
            layui.use('form', function () {
                var form = layui.form;

                //监听提交
                form.on('submit(formDemo)', function (data) {
                    layer.msg(JSON.stringify(data.field));
                    return false;
                });
            });
        </script>
    </body>
</html>
